OBJ = common_log.o logger.o type_converter.o 
LIB = libcommon_log.a
EXE = TestMain
HOMEDIR = ../../

#-Wl,--whole-archive -lyourliba -Wl,--no-whole-archive
CXX	= g++ 
FLAG = -fPIC -g -Wall -Wno-deprecated -D_DEBUG -D_STAT 
#FLAG = -fPIC -g -Wall -Wno-deprecated -D_DEBUG -D_STAT -D_FILE_OFFSET_BITS=64 -DDEBUG -D_REENTRANT -fprofile-arcs -ftest-coverage -Wl,--no-whole-archive 
CXX	+= $(FLAG)
DEF	= -D_TRACE
GLOBINC	= -I$(HOMEDIR)/include/
GLOBLIB = -L$(HOMEDIR)/lib/

.PHONY : all clean

all : $(LIB) $(OBJ) $(EXE)
	mkdir -p $(HOMEDIR)/include/common_log
	mkdir -p $(HOMEDIR)/lib
	mkdir -p $(HOMEDIR)/c++_swig
	cp -f common_log.h logger.h $(HOMEDIR)/include/common_log
	cp -f $(LIB) $(HOMEDIR)/lib/
	cp -f common_log.h logger.h $(LIB) $(HOMEDIR)/c++_swig/

$(LIB) : $(OBJ)
	ar -crs $@ $^

common_log.o : common_log.cpp
	$(CXX) -c common_log.cpp 
logger.o : logger.cpp
	$(CXX) -c logger.cpp -I../util 
type_converter.o : ../util/type_converter.cpp
	$(CXX) -c ../util/type_converter.cpp 

TestMain : main.cpp
	$(CXX) -o $@ $^ -I../util -I./ -L./ ./libcommon_log.a 

clean:
	rm -rf $(OBJ) $(LIB) $(EXE)

